package com.heima.admin.controller;

import com.heima.admin.service.AdminWmNewsService;
import com.heima.model.admin.dtos.NewsAuthDto;
import com.heima.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 文章审核相关接口
 */
@RestController
@RequestMapping("/api/v1/news")
public class AdminWmNewsController {

    @Autowired
    private AdminWmNewsService newsService;


    //文章列表查询
    @PostMapping("/list_vo")
    public ResponseResult listNews(@RequestBody NewsAuthDto dto) {
        return newsService.listNewsVo(dto);
    }

    //查询文章详情
    @GetMapping("/one_vo/{id}")
    public ResponseResult getNewsDetail(@PathVariable Integer id) {
        return newsService.getNewsDetail(id);
    }

    //人工审核 成功
    @PostMapping("/auth_fail")
    public ResponseResult authFail(@RequestBody NewsAuthDto dto) {
        return newsService.authFail(dto);
    }

    //人工审核 拒绝
    @PostMapping("/auth_pass")
    public ResponseResult authPass(@RequestBody NewsAuthDto dto) {
        return newsService.authPass(dto);
    }
}
